<?php
/**
 * Created by PhpStorm.
 * User: mr.lee
 * Date: 2018/3/28
 * Time: 上午9:03
 */

namespace app\common\controller;
use app\common\model\Agent;
use app\common\model\Merchant;
use app\common\model\Momerchant;
use think\Controller;
class Platinfo extends Controller
{

    //获取所属代理商的链接
    public function getagentinfo($type,$param){

        $Merchant = new Merchant();
        $Agent=new Agent();
        $Momerchant = new Momerchant();
        $info['agent_id'] = $param;
        switch($type){
            case "top_mid":
                $info['agent_id'] = $Momerchant->where('id', $param)->value('agent');
                break;
            case "mid":
                $mids = is_array($param)?$param:explode(',',$param);
                $info['agent_id'] = $Merchant->where(['id'=>['in',$mids]])->value('agent');
                break;
            case "agent_id";
                $info['agent_id'] = $param;
//                $agent_url = $Agent->where(['id'=>$param])->value('open_url');
                break;
        }
        return $info;

    }

}